import React, { Component } from 'react'
import { TopicWrapper, TopicItem } from '../style'
import { connect } from 'react-redux'

class Topic extends Component {
  render() {
    const { list } = this.props
    console.log(list)
    return (
      <TopicWrapper>
        {list.map(item => {
          return (
            <TopicItem key={item.get('id')}>
              <img className="topic-img" alt="topic" src={item.get('img')} />
              {item.get('title')}
            </TopicItem>
          )
        })}
        <div className="topic-more">更多热门专题 ></div>
      </TopicWrapper>
    )
  }
}

const mapStateToProps = state => ({
  list: state.get('home').get('topicList')
})
export default connect(
  mapStateToProps,
  null
)(Topic)
